package com.cos.web.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author: COS
 * @time: 2021/11/22 14:40
 * @description:
 */
@Controller
@RequestMapping("/ann")
public class TestAnnController {

    @PreAuthorize(value = "hasAnyRole('USER')")
    @RequestMapping("/t1")
    public String t1() {
        System.out.println("t1");
        return "index";
    }
    @PreAuthorize(value = "hasAnyRole('ROLE_ADMIN')")
    @RequestMapping("/t2")
    public String t2() {
        System.out.println("t2");
        return "index";
    }
    @PreAuthorize(value = "hasAnyRole({'ROLE_ADMIN','ROLE_USER'})")

    @RequestMapping("/t3")
    public String t3() {
        System.out.println("t2");
        return "index";
    }



}
